#include "system.h"

// 定义一个 System 对象
System_t system;

/*
	状态LED闪烁
*/
void state_led(void) {
    if (system.StateLed.state_led_count >= system.StateLed.state_led_ms_flag) {
        STATE_LED_TOGGLE();
        system.StateLed.state_led_count = 0;
    }
}

/*
	初始化 System
*/
void system_init(System_t *system)
{
    system->StateLed.state_led_count = 0;
	system->StateLed.state_led_ms_flag = 500;
    system->StateLed.state_led = state_led;
	system->StateLed.set_freq = set_freq;
}

/*
	设置状态LED闪烁频率周期
*/
void set_freq(uint32_t period_ms)
{
	system.StateLed.state_led_ms_flag = period_ms;
}
